# -*- coding: utf-8 -*-
from datetime import timedelta
from jms.dwd.tab.dwd_tab_barscan_centerarrival_base_dt import jms_dwd__dwd_tab_barscan_centerarrival_base_dt
from jms.dwd.tab.dwd_tab_barscan_centersend_base_dt import jms_dwd__dwd_tab_barscan_centersend_base_dt
from jms.dim.dim_network_whole_massage import jms_dim__dim_network_whole_massage
from jms.time_sensor.time_after_06_00 import time_after_06_00
from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator

jms_dm__dm_tab_inport_center_summary_dt = SparkSqlOperator(
    task_id='jms_dm__dm_tab_inport_center_summary_dt',
    email=['shenjiaming@jtexpress.com', 'yl_bigdata@yl-scm.com'],
    name='jms_dm__dm_tab_inport_center_summary_dt_{{ execution_date | date_add(1) | cst_ds }}',
    sql='jms/dm/dm_tab_inport_center_summary_dt/execute.hql',
    pool_slots=1,
    executor_cores=2 , 
    driver_cores=4 , 
    executor_memory='4G' , 
    driver_memory='4G' , 
    num_executors=5 , 
    conf={
        'spark.dynamicAllocation.maxExecutors'             : 6 , 
          'spark.sql.sources.partitionOverwriteMode': 'dynamic',
          'spark.dynamicallocation.enabled': 'true',
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': '600',
          'spark.shuffle.service.enabled': 'true',
          'spark.sql.shuffle.partitions': '320',
          'spark.driver.maxResultSize': '12',
          'spark.sql.broadcastTimeout': '3600',
          'spark.yarn.executor.memoryOverhead': '46',
          'spark.core.connection.ack.wait.timeout': '600',
          'spark.shuffle.io.maxRetries': '6'
          },
    #hiveconf={'hive.exec.dynamic.partition': 'true',
#              'hive.exec.dynamic.partition.mode': 'nonstrict',
#              'hive.exec.max.dynamic.partitions.pernode': 5000,
#              'hive.exec.max.dynamic.partitions': 30000
#              },
    yarn_queue='pro',
    execution_timeout=timedelta(minutes=30),
)

jms_dm__dm_tab_inport_center_summary_dt << [jms_dwd__dwd_tab_barscan_centerarrival_base_dt
    , jms_dwd__dwd_tab_barscan_centersend_base_dt
    , jms_dim__dim_network_whole_massage
    , time_after_06_00]
